Skip to content

feat: consume bootstrap via struts webjars (5.3.8 + icons 1.13.1) - #423

Open
lukaszlenart wants to merge 10 commits into
release/6.0.xfrom
docs/webjars-support-design
Open

feat: consume bootstrap via struts webjars (5.3.8 + icons 1.13.1)#423
lukaszlenart wants to merge 10 commits into
release/6.0.xfrom
docs/webjars-support-design

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

What

Replaces the plugin's ~2000 manually-vendored Bootstrap and bootstrap-icons files with org.webjars dependencies, served via Struts core's new WebJars support (<@s.webjar> / apache/struts WW-5640, PR apache/struts#1765).

  • Bootstrap 5.3.5 → 5.3.8, bootstrap-icons 1.11.3 → 1.13.1, now sourced from org.webjars:bootstrap + org.webjars.npm:bootstrap-icons.
  • head.ftl resolves asset URLs through <@s.webjar path="…" var="…"/> and composes them into <@s.script>/<@s.link> via OGNL %{#var}.
  • Deletes the vendored template/bootstrap/css/**, template/bootstrap/bootstrap-icons/**, and template/bootstrap/js/bootstrap*. Keeps the plugin's own validation.js/validation.min.js.
  • Plugin artifact shrinks from ~3.5 MB → 48 KB. Future Bootstrap bumps become a one-line dependency change (Renovate-friendly).

Why

Every Bootstrap release previously required re-downloading and re-committing ~2000 files by hand. WebJars turn that into a dependency bump.

⚠️ Do not merge yet — depends on an unreleased Struts

This builds against 7.2.2-SNAPSHOT (WebJars support is merged to Struts main but not yet released). A temporary Apache snapshots repository is added to the root pom.xml.

Before merge, once Struts 7.2.2 is published: remove the apache-snapshots <repositories> block and pin struts2.version to 7.2.2.

Verification

Verified end-to-end against 7.2.2-SNAPSHOT via the showcase (mvn -pl struts2-bootstrap-showcase jetty:run):

  • …/static/webjars/bootstrap/5.3.8/css/bootstrap.min.css200 text/css
  • …/static/webjars/bootstrap/5.3.8/js/bootstrap.bundle.min.js200 text/javascript
  • …/static/webjars/bootstrap-icons/1.13.1/font/bootstrap-icons.min.css200 text/css
  • …/static/webjars/bootstrap-icons/1.13.1/font/fonts/bootstrap-icons.woff2200 font/woff2 (confirms the icons CSS relative ./fonts/ path resolves)
  • validation.min.js still served from the plugin static path → 200
  • No FreeMarker errors; full reactor mvn clean install green.

Notes

  • Release version in the README/compat table is set to 6.1.1 (matches current pom.xml); adjust if a different version is intended.
  • Design & plan under docs/superpowers/.

🤖 Generated with Claude Code

lukaszlenart and others added 10 commits July 1, 2026 09:47
…umer)

Requirements/design spec for adding first-class WebJars support to Struts
core, served through the static-content pipeline with version-less path
resolution, and consuming it from the struts2-bootstrap plugin to replace
the ~2000 manually-vendored Bootstrap/bootstrap-icons files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Self-contained, repo-portable framework-only spec to start WebJars support
work fresh in apache/struts. Plugin-side consumer work continues here once
the framework support ships.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Framework support merged (apache/struts PR #1765, WW-5640, in 7.2.2-SNAPSHOT).
Plan covers pom deps + struts 7.2.2 floor, head.ftl -> <@s.webjar>, removal of
vendored bootstrap/bootstrap-icons, README, and showcase verification. Coding
deferred until Struts 7.2.2 is released.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Build against 7.2.2-SNAPSHOT (Apache snapshots repo) until 7.2.2 is released.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The <#assign>..</#assign> capture of <@s.webjar> yields a FreeMarker
markup_output, which ?trim rejects. Use the tag's var attribute (stored in
the value-stack context) and reference it through OGNL %{#var} in
<@s.script>/<@s.link> src/href (both OGNL-evaluated via findString).
Verified end-to-end in the showcase: bootstrap css/js, icons css and woff2
all serve 200.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant